
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/24/2011 23:31:51
-- Generated from EDMX file: D:\workspace\voweianother\src\mynote\mynote.data\Models\FullTextIndex.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_IndexDbFile_inherits_IndexDbDirectory]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[IndexDbDirectorySet_IndexDbFile] DROP CONSTRAINT [FK_IndexDbFile_inherits_IndexDbDirectory];
GO

-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[IndexDbDirectorySet]', 'U') IS NOT NULL
    DROP TABLE [dbo].[IndexDbDirectorySet];
GO
IF OBJECT_ID(N'[dbo].[IndexDbDirectorySet_IndexDbFile]', 'U') IS NOT NULL
    DROP TABLE [dbo].[IndexDbDirectorySet_IndexDbFile];
GO

-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'IndexDbDirectorySet'
CREATE TABLE [dbo].[IndexDbDirectorySet] (
    [Id] uniqueidentifier  NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [CreateTime] datetime  NOT NULL,
    [LastWriteTime] datetime  NOT NULL
);
GO

-- Creating table 'IndexDbDirectorySet_IndexDbFile'
CREATE TABLE [dbo].[IndexDbDirectorySet_IndexDbFile] (
    [Content] varbinary(max)  NULL,
    [Id] uniqueidentifier  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [Id] in table 'IndexDbDirectorySet'
ALTER TABLE [dbo].[IndexDbDirectorySet]
ADD CONSTRAINT [PK_IndexDbDirectorySet]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'IndexDbDirectorySet_IndexDbFile'
ALTER TABLE [dbo].[IndexDbDirectorySet_IndexDbFile]
ADD CONSTRAINT [PK_IndexDbDirectorySet_IndexDbFile]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- Creating foreign key on [Id] in table 'IndexDbDirectorySet_IndexDbFile'
ALTER TABLE [dbo].[IndexDbDirectorySet_IndexDbFile]
ADD CONSTRAINT [FK_IndexDbFile_inherits_IndexDbDirectory]
    FOREIGN KEY ([Id])
    REFERENCES [dbo].[IndexDbDirectorySet]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------